package com.mapperdb.db;

import java.io.Serializable;
import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface DbMapper<T> {
	// --------------------------------------------------------
	// select
	// --------------------------------------------------------
	public T selectByPrimaryKey(@Param("id") Serializable idVal);

	public T selectByPrimaryKeys(T record);

	public T selectOneByWhereSql(@Param("sql") String sql, @Param("param") Object param);

	public List<T> selectListByWhereSql(@Param("sql") String sql, @Param("param") Object param);

	public List<T> selectList(T record);

	public T selectOne(T record);

	public int selectCount();

	public int selectCountByWhereSql(@Param("sql") String sql, @Param("param") Object param);

	// --------------------------------------------------------
	// update
	// --------------------------------------------------------
	public int updateByPrimaryKey(T record);

	public int updateByPrimaryKeySelective(T record);

	public int updateByWhereSql(@Param("record") T record, @Param("sql") String sql, @Param("param") Object param);

	public int updateByWhereSqlSelective(@Param("record") T record, @Param("sql") String sql, @Param("param") Object param);

	// --------------------------------------------------------
	// insert
	// --------------------------------------------------------
	public int insertSelective(T record);

	public int insert(T record);

	// --------------------------------------------------------
	// delete
	// --------------------------------------------------------
	public int delete(T record);

	public int deleteByPrimaryKeys(T record);

	public int deleteByPrimaryKey(@Param("id") Serializable key);

	public int deleteByWhereSql(@Param("sql") String sql, @Param("param") Object param);
}
